module.exports = {
    eventFieldTransfer : function (fields, model,filter) {
        return @.keys(fields).reduce(function(table, fld) {
            if (filter && filter.indexOf(fields[fld].type) < 0){
                return table;
            }
            switch (fields[fld].type) {
                case "id":
                    table[fld] = {
                        "!valueType": "string",
                        "!indexed": true,
                        "!esType": "string"
                    }
                    break;
                case "range":
                    table[fld] = {
                        "!indexed": true,
                        "!columnType": "integer",
                        "!valueType": "number",
                        "!defaultValue": 0,
                        "!esType": "number",
                        "!numberType" : "diff"
                    }
                    break;
                case "money" : {
                    table[fld] = {
                        "!columnType"   : "real",
                        "!valueType"    : "number",
                        "!defaultValue" : 0,
                        "!esType"       : "double",
                        "!numberType"   : "diff"
                    }
                    break;
                }
                case "text":
                    table[fld] = {
                        "!valueType": "string",
                        "!columnSize": 512,
                        "!esType": "string"
                    }
                    break;
                default:
                    @warn(kittyName + "." + name + "." + fld + " type not support : " + fields[fld].type);
            };
            return table;
        }, model || {});
    }
}